public class StatisticData {
    private int totalCount;
    private double totalSum;
    private double averageValue;
    private int maxValue;
    private int minValue;

    // 构造方法、getter 和 setter 等
    public StatisticData() {}

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public double getTotalSum() {
        return totalSum;
    }

    public void setTotalSum(double totalSum) {
        this.totalSum = totalSum;
    }

    public double getAverageValue() {
        return averageValue;
    }

    public void setAverageValue(double averageValue) {
        this.averageValue = averageValue;
    }

    public int getMaxValue() {
        return maxValue;
    }

    public void setMaxValue(int maxValue) {
        this.maxValue = maxValue;
    }

    public int getMinValue() {
        return minValue;
    }

    public void setMinValue(int minValue) {
        this.minValue = minValue;
    }
}

public class StatisticModel {

    // 模拟获取数据并进行统计分析
    public StatisticData calculateStatistics(List<Integer> dataList) {
        StatisticData data = new StatisticData();

        if (dataList.isEmpty()) {
            throw new RuntimeException("数据列表不能为空");
        }

        int total = 0;
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;

        for (Integer value : dataList) {
            total += value;
            if (value > max) {
                max = value;
            }
            if (value < min) {
                min = value;
            }
        }

        data.setTotalCount(dataList.size());
        data.setTotalSum(total);
        data.setAverageValue((double) total / dataList.size());
        data.setMaxValue(max);
        data.setMinValue(min);

        return data;
    }
}

public interface StatisticView {

    void onStatisticsSuccess(StatisticData data);

    void onStatisticsFailure(String error);
}

public class StatisticPresenter {

    private StatisticModel statisticModel;
    private StatisticView statisticView;

    public StatisticPresenter(StatisticModel statisticModel, StatisticView statisticView) {
        this.statisticModel = statisticModel;
        this.statisticView = statisticView;
    }

    public void performStatistics(List<Integer> dataList) {
        try {
            StatisticData data = statisticModel.calculateStatistics(dataList);
            statisticView.onStatisticsSuccess(data);
        } catch (Exception e) {
            statisticView.onStatisticsFailure("统计出错: " + e.getMessage());
        }
    }
}

public class MainActivity extends AppCompatActivity implements StatisticView {

    private StatisticPresenter statisticPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        StatisticModel statisticModel = new StatisticModel();
        statisticPresenter = new StatisticPresenter(statisticModel, this);
    }

    public void onStatisticsButtonClicked(View view) {
        List<Integer> dataList = new ArrayList<>();
        dataList.add(10);
        dataList.add(20);
        dataList.add(30);
        dataList.add(40);
        dataList.add(50);

        statisticPresenter.performStatistics(dataList);
    }

    @Override
    public void onStatisticsSuccess(StatisticData data) {
        Toast.makeText(this, "总数量: " + data.getTotalCount() + ", 总和: " + data.getTotalSum() + ", 平均值: " + data.getAverageValue() + ", 最大值: " + data.getMaxValue() + ", 最小值: " + data.getMinValue(), Toast.LENGTH_LONG).show();
    }

    @Override
    public void onStatisticsFailure(String error) {
        Toast.makeText(this, error, Toast.LENGTH_SHORT).show();
    }
}